{template 'common/header-base'}
	{if $_W['role'] != 'clerk'}
<div id="page-container" class="sidebar-l sidebar-o side-scroll header-navbar-fixed gw-container gw-container">

 <nav id="sidebar">

                <div id="sidebar-scroll" style="">

                    <div class="sidebar-content">

                        <div class="side-header side-content bg-white-op">

                            <button class="btn btn-link text-gray pull-right hidden-md hidden-lg" type="button" data-toggle="layout" data-action="sidebar_close">
                                <i class="fa fa-times"></i>
                            </button>


                            <a class="gw-logo"  href="./?refresh"{if !empty($_W['setting']['copyright']['blogo'])}style="background:url('{php echo tomedia($_W['setting']['copyright']['blogo']);}') no-repeat;"{/if}></a>
                        </div>
<style>
    .newbtn{
    width: 230px;
    background-color: #2c343f;
    }
    .newbtnchild{
        width: 33.6%;
    border: none;
    border-radius: 0px;
    }

</style>
        <div class="side-content">
            <ul class="nav-main">

            {php $frames = empty($frames) ? $GLOBALS['frames'] : $frames; _calc_current_frames($frames);}
            {if !empty($frames)}
            <div id="search-menu">
                        <input class="form-control input-lg" style="border-radius:0; font-size:14px; height:43px;border: none;background-color: rgba(0,0,0,.15);" type="text" placeholder="输入菜单名称可快速查找">
                    </div>

               {if $GLOBALS['ext_type'] > 0}
                        <div class="btn-group newbtn">
                            <button class="btn newbtnchild {if $GLOBALS['ext_type'] == 1}btn-primary{else}btn-default{/if} ext-type" data-id="1">默认</button>
                            <button class="btn newbtnchild {if $GLOBALS['ext_type'] == 2}btn-primary{else}btn-default{/if} ext-type" data-id="2">系统</button>
                            <button class="btn newbtnchild {if $GLOBALS['ext_type'] == 3}btn-primary{else}btn-default{/if} ext-type" data-id="3">复合</button>
                        </div>
                    {/if}
                <!-- <li class="nav-main-heading"><span class="sidebar-mini-hide">User Interface</span></li> -->
                {loop $frames $k $frame}
                <li class="open">
    <?php
        switch ($frame['title']) {
            case '基本功能':
            $snav_icon = 'fontello-icon-cog-1';
            break;
            case '高级功能':
            $snav_icon = 'fontello-icon-beaker';
            break;
            case '数据统计':
            $snav_icon = 'fontello-icon-chart-line';
            break;
            case '管理':
            $snav_icon = 'fontello-icon-wrench-2';
            break;
            case '微站管理':
            $snav_icon = 'fontello-icon-globe-2';
            break;
            case '特殊页面管理':
            $snav_icon = 'fontello-icon-doc-1';
            break;
            case '功能组件':
            $snav_icon = 'fontello-icon-puzzle';
            break;
            case '粉丝管理':
            $snav_icon = 'fontello-icon-users-1';
            break;
            case '会员中心':
            $snav_icon = 'fontello-icon-user-5';
            break;
            case '会员卡管理':
            $snav_icon = 'fontello-icon-vcard';
            break;
            case '积分兑换':
            $snav_icon = 'fontello-icon-dollar';
            break;
            case '通知中心':
            $snav_icon = 'fontello-icon-bullhorn';
            break;
            case '公众号选项':
            $snav_icon = 'fontello-icon-chat-1';
            break;
            case '会员及粉丝选项':
            $snav_icon = 'fontello-icon-users';
            break;
            case '其他功能选项':
            $snav_icon = 'fontello-icon-cog-alt';
            break;
            case '主要业务':
            $snav_icon = 'fontello-icon-th-3';
            break;
            case '营销及活动':
            $snav_icon = 'fontello-icon-gift';
            break;
            case '客户关系':
            $snav_icon = 'fontello-icon-share-1';
            break;
            case '常用服务及工具':
            $snav_icon = 'fontello-icon-wrench';
            break;
            case '其他':
            $snav_icon = 'fontello-icon-dot-3';
            break;
            default:
            $snav_icon = 'fontello-icon-list-add';
            }
      ?>
                       <a class="nav-submenu listh" data-toggle="nav-submenu" href="#" ><i class="{$snav_icon}"></i><span class="sidebar-mini-hide">{$frame['title']}</span></a>

                <ul>
                    {loop $frame['items'] $link}
                        {if !empty($link['append'])}
                        <li onclick="window.location.href = '{$link['url']}';"  kw="{$link['title']}" class="lista">
                            <a href="{$link['url']}">{$link['title']}</a>
                        </li>
                        {else}
                        <a href="{$link['url']}" kw="{$link['title']}" class="lista">{$link['title']}</a>
                        {/if}
                    {/loop}
               </ul>
            </li>
                {/loop}


<div style="display:none" >
<div id="dying" style="min-height:800px">

<div class="col-xs-12 col-sm-6 col-lg-12">
<div class="page-header" style="margin-top:15px">
    <h4><i class="{$snav_icon}"></i> 全部模块</h4>
</div>
{if $moudles}
{if $enable_modules}
{loop $enable_modules $key $row}
    {if empty($current_user_permission_types) || in_array($key, $current_user_permission_types) || $row['issystem'] == 1}

<div class="col-xs-6 col-sm-6 col-lg-2" style="text-align: center;margin-bottom: 10px;">
    <a class="item item-circle text-white-op center-block"  href="{if $row['type'] != 'system'}./index.php?c=home&a=welcome&do=ext{else}./index.php?c=platform&a=reply{/if}&m={$row['name']}">

        <img src="{$row['icon']}" alt="{$row['title']}" class="img-avatar" />

    </a>
    <div class="push-10-t font-w600">{$row['title']}</div>
</div>
{/if}

{/loop}
{/if}
{/if}
</div>

</div>
</div>




     <script type="text/javascript">
       $('.nav-main ul a>i').css({"display":"none","padding-right":"0px"});
                        require(['bootstrap'], function(){
                            $('.ext-type').click(function(){
                                var id = $(this).data('id');
                                util.cookie.del('ext_type');
                                util.cookie.set('ext_type', id, 7*86400);

                                location.reload();
                                return false;
                            });

                            $('#search-menu input').keyup(function() {
                                var a = $(this).val();
                                $('.listh,.lista').hide();
                                $('.lista').each(function() {
                                    $(this).css('border-left', '0');
                                    if(a.length > 0 && $(this).attr('kw').indexOf(a) >= 0) {
                                        $(this).parents(".nav-main").find('.listh').show();
                                        $(this).show().css('border-left', '3px #428bca double');
                                    }
                                });
                                if(a.length == 0) {
                                    $('.listh,.lista').show();
                                }
                            });
                        });
                    </script>
<!--                <script type="text/javascript">
                        require(['bootstrap'], function(){
                            $('#search-menu input').keyup(function() {
                                var a = $(this).val();
                                $('.big-menu .list-group-item, .big-menu .panel-heading').hide();
                                $('.big-menu .list-group-item').each(function() {
                                    $(this).css('border-left', '0');
                                    if(a.length > 0 && $(this).attr('kw').indexOf(a) >= 0) {
                                        $(this).parents(".panel").find('.panel-heading').show();
                                        $(this).show().css('border-left', '3px #428bca double');
                                    }
                                });
                                if(a.length == 0) {
                                    $('.big-menu .list-group-item, .big-menu .panel-heading').show();
                                }
                            });
                        });
                    </script> -->

                {/if}
           </ul>
        </div>

                    </div>

                </div>

    </nav>


    <!-- Header -->
    <header id="header-navbar" class="content-mini content-mini-full">
        <!-- Header Navigation Right -->
        <ul class="nav-header pull-right">

        <li class="dropdown topbar-notice">
                    <a type="button"  data-toggle="dropdown" style="padding-left:15px">
                        <span class="badge badge-primary" ><i class="fa fa-bell"></i> <span id="notice-total">0</span> </span>                    </a>
                    <div class="dropdown-menu animated bounceInDown" aria-labelledby="dLabel">
                        <div class="block notnew">
                            <div class="block-content">
                                <ul id="notice-container" ></ul>
                            </div>
                        </div>
                    </div>
                </li>
            <li id="liebiao">
               <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button" >
                    <i class="fa fa-th-list"></i>
                </button>
                <ul class="dropdown-menu dropdown-menu-right animated bounceInDown">
                    {php global $top_nav;}
                    {loop $top_nav $nav}
                        {if !empty($_W['isfounder']) || empty($_W['setting']['permurls']['sections']) || in_array($nav['name'], $_W['setting']['permurls']['sections'])}<li{if FRAME == $nav['name']} class="active"{/if}><a href="{php echo url('home/welcome/' . $nav['name']);}"><i class="{$nav['append_title']} pull-right"></i> {$nav['title']}</a></li>{/if}
                    {/loop}

                </ul>
                </div>
            </li>
            <li>
                <div class="btn-group">
                    <button class="btn btn-default btn-image dropdown-toggle" data-toggle="dropdown" type="button">
                        <img src="{$_W['attachurl']}headimg_{$_W['uniacid']}.jpg?$acid={$_W['uniacid']}" onerror="this.src='resource/images/gw-wx.gif'" />
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu dropdown-menu-right animated bounceInDown">
                        <li class="dropdown-header">{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if})</li>
                        <li>
                            <a tabindex="-1" href="###">
                                <i class="fontello-icon-comment-alt-1 pull-right"></i>
                                {$_W['account']['name']}
                            </a>
                        </li>

                        {if $_W['role'] != 'operator'}
                        <li>
                            <a tabindex="-1" href="{url 'account/post' array('uniacid' => $_W['uniacid'])}" >
                                <i class="fontello-icon-edit pull-right"></i>编辑当前账号资料
                            </a>
                        </li>
                        {/if}
                        <li>
                            <a tabindex="-1" href="{url 'account/display'}" >
                                <i class="fontello-icon-chat-1 pull-right"></i>管理其它公众号
                            </a>
                        </li>
                        <li class="xp">
                            <a tabindex="-1" href="{url 'utility/emulator'}">
                                <i class="fontello-icon-edit-2 pull-right"></i>模拟测试
                            </a>
                        </li>
                        <li class="divider"></li>

                        <li><a href="{url 'user/profile/profile'}"><i class="fontello-icon-vcard pull-right"></i> 我的账号</a></li>
                {if $_W['role'] == 'founder'}
                <li><a href="{url 'system/welcome'}"><i class="fontello-icon-cog-alt pull-right"></i> 系统选项</a></li>
                <li><a href="{url 'system/welcome'}"><i class="fontello-icon-spin3 pull-right"></i> 自动更新</a></li>
                <li><a href="{url 'system/updatecache'}"><i class="fontello-icon-loop-alt pull-right"></i> 更新缓存</a></li>
                <li class="divider"></li>
                {/if}
                <li><a href="{url 'user/logout'}"><i class="fontello-icon-logout-1 pull-right"></i> 退出系统</a></li>
                    </ul>
                </div>
            </li>

        </ul>
        <!-- END Header Navigation Right -->

        <!-- Header Navigation Left -->
        <ul class="nav-header pull-left">
            <li class="hidden-md hidden-lg" style="margin-right: 1px;">
                <button class="btn btn-default" data-toggle="layout" data-action="sidebar_toggle" type="button">
                    <i class="fa fa-navicon"></i>
                </button>
            </li>
            <li class="hidden-xs hidden-sm">
                <button class="btn btn-default" data-toggle="layout" data-action="sidebar_mini_toggle" type="button">
                    <i class="fa fa-ellipsis-v"></i>
                </button>
            </li>
            {php global $top_nav;}
            {loop $top_nav $nav}
                {if !empty($_W['isfounder']) || empty($_W['setting']['permurls']['sections']) || in_array($nav['name'], $_W['setting']['permurls']['sections'])}<li{if FRAME == $nav['name']} class="active"{/if}  id="liebiaoyuan"><a href="{php echo url('home/welcome/' . $nav['name']);}"><i class="{$nav['append_title']}"></i> {$nav['title']}</a></li>{/if}
            {/loop}
        </ul>
        <!-- END Header Navigation Left -->
    </header>
    {if empty($_COOKIE['check_setmeal']) && !empty($_W['account']['endtime']) && ($_W['account']['endtime'] - TIMESTAMP < (6*86400))}
        <div class="upgrade-tips" id="setmeal-tips">
            <a href="{php echo url('user/edit', array('uid' => $_W['account']['uid']));}" target="_blank">
                您的服务有效期限：{php echo date('Y-m-d', $_W['account']['starttime']);} ~ {php echo date('Y-m-d', $_W['account']['endtime']);}.
                {if $_W['account']['endtime'] < TIMESTAMP}
                目前已到期，请联系管理员续费
                {else}
                将在{php echo ($_W['account']['endtime'] - strtotime(date('Y-m-d')))/86400}天后到期，请及时付费
                {/if}
            </a><span class="tips-close" style="background:#d03e14;" onclick="check_setmeal_hide();"><i class="fa fa-times-circle"></i></span>
        </div>
        <script>
            function check_setmeal_hide() {
                util.cookie.set('check_setmeal', 1, 1800);
                $('#setmeal-tips').hide();
                return false;
            }
        </script>
    {/if}

               {if defined('IN_MESSAGE')}
            <div class="row text-center">
                <div class="col-xs-12 col-sm-12 col-lg-12">
                <div class="alert alert-{$label} alert-dismissable">

                    {if is_array($msg)}
                        <h3 class="font-w300 push-15">MYSQL 错误：</h3>
                        <p>{php echo cutstr($msg['sql'], 300, 1);}</p>
                        <p><b>{$msg['error'][0]} {$msg['error'][1]}：</b>{$msg['error'][2]}</p>
                    {else}
                    <h3 class="font-w300 push-15"><i class="fa fa-{if $label=='success'}check-circle{/if}{if $label=='danger'}times-circle{/if}{if $label=='info'}info-circle{/if}{if $label=='warning'}exclamation-triangle{/if}"></i> {$msg}</h3>
                    {/if}
                    {if $redirect}
                    <p><a href="{$redirect}">如果你的浏览器没有自动跳转，请点击此链接</a></p>
                    <script type="text/javascript">
                        setTimeout(function () {
                            location.href = "{$redirect}";
                        }, 3000);
                    </script>
                    {else}
                        <p>[<a href="javascript:history.go(-1);">点击这里返回上一页</a>] &nbsp; [<a href="./?refresh">首页</a>]</p>
                    {/if}
                </div>
            </div>
        </div>
        {/if}
        {/if}


<script>
    var h = document.documentElement.clientHeight;
    $(".gw-container").css('min-height',h-60);

</script>